<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户拥有角色列表</title>
<link href="../style/css_member.css" rel="stylesheet" type="text/css" />
<script src="../js/artDialog.js?skin=gray"></script>
<script src="../js/artDialog.iframeTools.js"></script>
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>

<script type="text/javascript">

function closeWin(){
	art.dialog.close();
}

function auth(id,roldId){

	window.location.href = "${ctx}/security/user!auth.do?id="+id+"&roleId="+roldId;
}

function unauth(id,roldId){
	window.location.href = "${ctx}/security/user!unauth.do?id="+id+"&roleId="+roldId;
}
</script>

</head>
<body>

<table width="80%" class="tbl" cellpadding="0" cellspacing="0" align="center" style="margin: 30px 0px 30px 0px">
	<tr bgcolor="#CDE1ED">
		<td height="35">序号</td>
		<td>角色</td>
		<td>描述</td>
		<td>是否授权</td>
		<td>操作</td>
	</tr>
	<c:forEach var="role" items="${roleList}" varStatus="status">
		<tr>
			<td height="30">${status.count }</td>
			<td>${role.name }</td>
			<td>${role.descn }</td>
			<td>
				<c:choose>
					<c:when test="${role.authorized == true}"><font color="green"><b>已分配</b></font>
					</c:when>
					<c:otherwise><font color="red"><b>未分配</b></font>
					</c:otherwise>
			  </c:choose>
			</td>
			<td>
				 <c:choose>
						<c:when test="${role.authorized == true}">
							<input type="button" value="取消授权" onclick="unauth('${id }','${role.id}')" />
						</c:when>
						<c:otherwise>
						<input type="button" value="授权" onclick="auth('${id }','${role.id}')" />
						</c:otherwise>
				  </c:choose>
			</td>
		</tr>
	</c:forEach>
	<tr><td colspan="100%" height="40"><input type="button" value="关闭" onclick="closeWin()" /></td></tr>
</table>


</body>
</html>